﻿using System;
using ICU;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace ModificationChecker
{
    public class Loader : CSharpPlugin
    {
        public Loader(IServer _server, string path) : base(_server, path)
        {
            if (!(_server is Server))
            {
                GetLogger().Error("This is not an official server, the plugin will not work.");
                AppDomain.Unload(AppDomain.CreateDomain("wtf"));
                return;
            }
            Server server = _server as Server;
            if (!Directory.Exists("mods"))
            {
                Directory.CreateDirectory("mods");
            }
            foreach (var item in DataFolder.GetFiles())
            {
                if (item.Name.ToLower().EndsWith(".icumod.dll"))
                {
                    GetLogger().Info($"Loading modification: {item.Name}");
                }
            }
        }

        public override string Name => "ModificationChecker.Loader";

        public override string Desscription => "Load the modifications in mods folder.";

        public override string[] Author => new string[] { "Liyan Zhao(com.github.zly2006)" };

        public override Version Version => new Version(1, 0, 0);

        public override string HomePage => base.HomePage;

        public override string UpdateUrl => "http://www.starlight.cool/api/icu/plugins/u/2";

        public override string[] Commands => base.Commands;

    }
}
